package com.gkt.ec.cms.activity.dao;

import com.gkt.ec.cms.activity.model.domain.CompanyActivityEntity;
import com.gkt.ec.cms.activity.model.domain.CompanyEntity;
import com.gkt.ec.cms.activity.model.domain.CustomerActivityEntity;
import com.gkt.ec.cms.activity.model.domain.MarketActivityEntity;
import com.gkt.ec.cms.activity.model.pojo.SearchActivityVO;
import com.gkt.ec.commons.shared.persistence.CrudDao;
import com.gkt.ec.commons.shared.persistence.annotation.MyBatisDao;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;

import java.util.Date;
import java.util.HashMap;
import java.util.List;

/**
 * Created by 14081593 on 2015/11/30.
 */
@MyBatisDao
public interface MarketActivityDao extends CrudDao<MarketActivityEntity> {

    public int addActivity(MarketActivityEntity entity);

    public int addCompanyActivity(CompanyActivityEntity ca);

    public int addCustomerActivity(CustomerActivityEntity ca);

    public int cancelCustomerActivity(CustomerActivityEntity ca);

    public int cancelCompanyActivity(CompanyActivityEntity ca);

    public int updateActivity(MarketActivityEntity entity);

    public List<MarketActivityEntity> queryActivityList(SearchActivityVO searchCondition,RowBounds rowBounds);

    public MarketActivityEntity getActivityDetail(Long id);

    public List<CompanyEntity> getCompanyByActivityId(Long activityId);



    /**
     * 查询需要发送短信的任务列表
     * @return 活动列表
     */
    public List<MarketActivityEntity> querySendSmsActivity();


    /**
     * 更新给参与活动的客户发送短信的状态信息
     * @param customerActivityId 客户活动记录ID
     * @param smsSendStatus 发送状态 0：未发送 1：发送成功 2：发送失败
     * @param sentTime 发送时间
     */
    public void updateSendSmsCustomerStatus(@Param("id") Long customerActivityId,@Param("status") Integer smsSendStatus,
                                            @Param("sentTime") Date sentTime);

    /**
     * 更新活动发送短信任务完成情况信息
     * @param activityId 活动ID
     * @param smsSendStatus  发送状态 0：未发送 1：发送成功 2：发送失败
     * @param beginTime 开始时间
     * @param endTime   结束时间
     */
    public void updateSendSmsActivityStatus(@Param("id") Long activityId,@Param("status") Integer smsSendStatus,
                                            @Param("beginTime") Date beginTime,@Param("endTime") Date endTime);

    /**
     * 查询客户活动记录
     * @param activityId 活动ID
     * @return 客户活动记录列表
     */
    public List<CustomerActivityEntity> queryAllCustomerActivity(@Param("id") Long activityId);

    int delActivity(HashMap paramMap);
}
